home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / INTVAR.MOD < prev    next >
Text File  |  1989-01-18  |  856b  |  43 lines

  1.                                          (* Chapter 3 - Program 1 *)
  2. MODULE IntVar;
  3.  
  4. FROM InOut IMPORT WriteLn, WriteString, WriteInt;
  5.  
  6. VAR Count : INTEGER;  (* The sum of two variables *)
  7.     x,y   : INTEGER;  (* The two variables to add *)
  8.  
  9. BEGIN
  10.  
  11.    x := 12;
  12.    y := 13;
  13.    Count := x + y;
  14.  
  15.           (* Assignments complete, now display the results *)
  16.  
  17.    WriteString("The value of x  =");
  18.    WriteInt(x,3);
  19.    WriteLn;
  20.    WriteString("The value of y  =");
  21.    WriteInt(y,4);
  22.    WriteLn;
  23.    WriteString("The sum of them =");
  24.    WriteInt(Count,6);
  25.    WriteLn;
  26.  
  27.    x := 0FFH;   (* This is the way to assign a hexadecimal number *)
  28.    y := 177B;   (* This is the way to assign an octal number      *)
  29.  
  30. END IntVar.
  31.  
  32.  
  33.  
  34.  
  35. (* Result of execution
  36.  
  37. The value of x  = 12
  38. The value of y  =  13
  39. The sum of them =    25
  40.  
  41. *)
  42.  
  43.